Choosing the Right Load Balancer

Introduction to load balancers in GCP.

In the last lesson, we looked at the essential part of the Google Cloud, “VPC networking”. VPC is a mandatory component so, it is involved in every use case.

In this lesson, we will look at the next component of the Networking ecosystem, the “load balancer”. Cloud load balancing is the process of distributing workloads across multiple computing resources.

Introduction#

Cloud load balancing maximizes the availability of resources by routing traffic to appropriate healthy instances and also helps in monitoring the uptime of the service. The load balancer provides a single point of contact for a cluster of resources.

Goole Cloud provides different types of load balancing services based on the traffic you want to serve. You might have come across a load balancer while working with GKE. A load balancer needs a backend to distribute traffic which is served by the backend. We will look at the high-level overview of the load balancers.

Types of load balancers#

  • Open Main menu > Networking > Network services > Load balancing.

  • Click on the Create a load balancer button.

You will see the available types of load balancers from which you can select the one depending upon the layer at which you want to distribute traffic.

The available types of load balancers are:

  1. HTTPS Load Balancer.
  2. TCP Load Balancer.
  3. UDP Load Balancer.

Let’s see each one in detail.

HTTPS load balancing#

HTTPS is at layer 7 in the OSI model. Hence it is called layer 7 load balancing. HTTPS load balancing provides 2 options based on the origin of the incoming traffic to your VM instance.

  • External HTTPS traffic: If the traffic is coming from the internet to your VM instance using an IP address, you will use an external HTTPS load balancer.

  • Internal HTTPS traffic: If the traffic is from internal VMs to other internal VM you will use the internal HTTPS load balancer.

Load Balancing > HTTPS Load balancer.
Load Balancing > HTTPS Load balancer.

TCP load balancing#

TCP comes at layer 4. It is a layer 4 load balancing or proxy for applications that rely on TCP/SSL protocol. It can provide regional or multi-regional load balancing for the backends present in one or multiple regions. You can configure multiple options with TCP load balancing depending upon the requirements and type of traffic.

If you need SSL offload or TCP proxy you can configure that also using TCP load balancing. Google has created a decision chart to select the appropriate load balancing service for the specific use case. We will look at that at the end of this lesson.

Load Balancing >TCP Load balancer.
Load Balancing >TCP Load balancer.

UDP load balancing#

Then comes the layer 4 UDP load balancer for the applications that rely on the UDP protocol. Again depending upon the origin you can select the internal or external load balancer option.

Let’s look at the decision tree created by Google to see which load balancer service and configuration will be best suited depending upon the requirement.

Load Balancing > UDP Load balancer.
Load Balancing > UDP Load balancer.
UDP Traffic
UDP Traffic
HTTP or HTTPS
traffic 
HTTP or HTTPS<br>traffic 
TCP Traffic
TCP Traffic
         Network TCP/UDP
    Load Balancing
[Not supported by viewer]
       TCP Proxy
       TCP Proxy
        SSL Proxy
        SSL Proxy
HTTP(S)
          Load Balancing
[Not supported by viewer]
TCP Traffic
TCP Traffic
UDP Traffic
UDP Traffic
HTTP or HTTPS
traffic
HTTP or HTTPS<br>traffic
        Internal TCP/UDP
    Load Balancing
[Not supported by viewer]
Internal HTTP(S)
Load Balancing
Internal HTTP(S)<br>Load Balancing
SSL Offload?
SSL Offload?
Global LB or IPv6?
Global LB or IPv6?
Preserve
Client IPs?
Preserve <br>Client IPs?
NO
[Not supported by viewer]
YES
[Not supported by viewer]
YES
[Not supported by viewer]
NO
[Not supported by viewer]
NO
[Not supported by viewer]
YES
[Not supported by viewer]
External
---------------------
Internal-to-GCP traffic
[Not supported by viewer]
Internal
---------------------
Traffic to/from internal clients
[Not supported by viewer]
Internal IPv4 clients
[Not supported by viewer]
IPv4 clients
<font size="1"><b>IPv4 clients</b></font>
IPv6 clients
<font size="1"><b>IPv6 clients</b></font>
Decision chart to select right load balancer.

Except for external TCP traffic, other options are straightforward.

  • So, for external TCP traffic if you need “SSL Offload” then choose the “SSL Proxy” configuration.

  • If you don’t need SSL Offload but need to support global traffic or IPv6 then choose “TCP proxy.”

  • If you don’t need SSL Offload and you are supporting only IPv4 then depending upon the client IP preservation, if you need to preserve client IP then choose “TCP proxy” and if not then you can use “Network TCP Load balancing”.

Go through the chart 2-3 times so that you can easily tell which load balancer to choose for what situation. Usually, questions are based on this diagram only.

In the next lesson, we will look at the last network service which comes under the scope of this course. We will look at the Cloud DNS. It is a pretty straight forward service and it is not much different from other normal DNS services. So, let’s wrap up the Cloud DNS quickly.

Virtual Private Cloud (VPC)

Cloud DNS